package com.heima.article.controller.v1;

import com.heima.article.service.ApArticleService;
import com.heima.common.constants.ArticleConstants;
import com.heima.model.article.dtos.ArticleHomeDto;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/v1/article")
@Api(value = "app端文章首页", tags = "app端文章首页")
public class ApArticleHomeController{
	@Resource(name = "apArticleService", type = ApArticleService.class)
	private ApArticleService apArticleService;
	
	@PostMapping("/load")
	@ApiOperation("加载首页")
	public ResponseResult load(@RequestBody ArticleHomeDto dto){
		return apArticleService.load(ArticleConstants.LOADTYPE_LOAD_MORE, dto);
	}
	
	@PostMapping("/loadMore")
	@ApiOperation("加载更多")
	public ResponseResult loadMore(@RequestBody ArticleHomeDto dto){
		return apArticleService.load(ArticleConstants.LOADTYPE_LOAD_MORE, dto);
	}
	
	@PostMapping("/loadNew")
	@ApiOperation("加载最新")
	public ResponseResult loadNew(@RequestBody ArticleHomeDto dto){
		return apArticleService.load(ArticleConstants.LOADTYPE_LOAD_NEW, dto);
	}
	
}
